package example.day06;

/**
 * 演示对象创建的语法
 * 演示对象属性赋值的语法
 * 演示对象属性取值的语法
 */
public class OrderTest {
    public static void main(String[] args) {

        // 创建一个具体的订单对象1，并对成员变量赋值
        Order o1 = new Order();
        o1.orderId = "1";
        o1.userId = "u1";
        o1.amount = 300.0;
        o1.realAmount = 280.0;
        o1.date = "2021-03-08 11:40:30";

        // 创建一个具体的订单对象2，并对成员变量赋值
        // 列式编辑  alt+鼠标左键划选
        Order o2 = new Order();
        o2.orderId = "2";
        o2.userId = "u2";
        o2.amount = 500.0;
        o2.realAmount = 480.0;
        o2.date = "2021-03-07 11:40:30";


        // 判断对象1的应付金额是否大于对象2的应付金额
        if(o1.realAmount > o2.realAmount){
            // 如果大于，则打印订单1的订单号和应付金额
            System.out.println(o1.orderId + "," + o1.realAmount);
        }else{
            // 否则，则打印订单2的订单号和应付金额
            System.out.println(o2.orderId + "," + o2.realAmount);
        }
    }
}
